cc.Class({
    extends: cc.Component,

    properties: {
        scoreDisplay: {
            default: null,
            type: cc.Label
        },
		targetDisplay: {
            default: null,
            type: cc.Label
        },
		stepDisplay: {
            default: null,
            type: cc.Label
        },
		levelDisplay: {
            default: null,
            type: cc.Label
        },
		game: {
            default: null,
            type: cc.Node
        },
    },

    onLoad () {
		
		this.score = 0;
		this.level =0;
		this.target=0;
		this.level=0;
		
	},


    update (dt) {
		if(this.game.getComponent('Game').getScore()!=this.score){
			//console.log('change score');
			this.score = this.game.getComponent('Game').getScore();
			this.scoreDisplay.string = '得分:'+this.score;
		}
		
		if(this.game.getComponent('Game').getStep()!=this.step){
			//console.log('change step');
			this.step = this.game.getComponent('Game').getStep();
			this.stepDisplay.string = '步数:'+this.step;
		}
		
		if(this.game.getComponent('Game').getTarget()!=this.target){
			//console.log('change target');
			this.target = this.game.getComponent('Game').getTarget();
			this.targetDisplay.string = '目标:'+this.game.getComponent('Game').getTarget();
		}
		
		if(this.game.getComponent('Game').getLevel()!=this.level){
			//console.log('change level');
			this.level = this.game.getComponent('Game').getLevel();
			this.levelDisplay.string = '等级:'+(this.level+1);
		}
		
	},
});
